<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>叩丁狼骡窝窝后台管理系统</title>
<#include "../common/header.ftl" >
    <style>
        #contentModal img {
            width: 100%
        }
    </style>
    <script>
        $(function () {
            // 修改状态
            $('.changeStateBtn').click(function () {
                var id = $(this).data("id");
                var state = $(this).data("state");
                $.post("/travel/updateState", {id: id, state: state}, function (data) {
                    handleMessage(data)
                })
            });

            $(".lookBtn").click(function () {
                var id = $(this).data("id");
                $.get("/travel/getContentById", {id: id}, function (data) {
                    $('#contentModal .modal-body').html(data.content);
                    $('#contentModal').modal("show");
                });
            })
        })

    </script>


</head>
<body>

<#assign currentMenu="travel"/>
<div class="container-fluid" style="margin-top: 20px">
<#include "../common/top.ftl">
    <div class="row">
        <div class="col-sm-2">
        <#include "../common/menu.ftl">
        </div>
        <div class="col-sm-10">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">待审核游记列表</h1>
                </div>
            </div>
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/travel/list" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">

                <div class="form-group">
                    <label for="keyword">关键字:</label>
                    <input type="text" class="form-control" id="keyword" name="keyword" value="${(qo.keyword)!''}"
                           placeholder="请输入名称">
                </div>

                <div class="form-group">
                    <label for="dept">状态:</label>
                    <select id="auditState" class="form-control" autocomplete="off" name="state">

                        <option value="-1">全部</option>
                        <option value="1">待发布</option>
                        <option value="2">已发布</option>
                        <option value="3">已拒绝</option>
                    </select>
                    <script>
                        $("#auditState").val(${qo.state});
                    </script>
                    <button id="query" type="submit" class="btn btn-success"><i class="icon-search"></i> 查询</button>
                </div>
            </form>
            <table class="table table-striped table-hover" id="regionTb">
                <tr>
                    <th>编号</th>
                    <th>标题</th>
                    <th>封面</th>
                    <th>地点</th>
                    <th>作者</th>
                    <th>状态</th>
                    <th>操作</th>

                </tr>
            <#list pageInfo.list as entity>
                <tr>
                    <td>${entity_index+1}</td>
                    <td>${entity.title}</td>
                    <td><img src="${entity.coverUrl!}" width="50px"/></td>
                    <td>${entity.dest.name}</td>
                    <td>${entity.author.nickname}</td>
                    <td>${entity.stateDisplay}</td>
                    <td>


                        <#if  entity.state == 2>
                            <a class="btn btn-warning btn-xs changeStateBtn" href="javascript:;" data-state='1'
                               data-id="${entity.id}">
                                <span class="glyphicon glyphicon-minus-sign"></span> 下架
                            </a>
                        <#else>
                            <a class="btn btn-default btn-xs changeStateBtn" href="JavaScript:;" data-state="2"
                               data-id="${entity.id}">
                                <span class="glyphicon glyphicon-tag"></span> 发布
                            </a>
                        </#if>
                        <#if  entity.state != 3>
                            <a class="btn btn-danger btn-xs changeStateBtn" href="javascript:;" data-state="3"
                               data-id="${entity.id}">
                                <span class="glyphicon glyphicon-remove"></span> 拒绝
                            </a>
                        </#if>
                        <a class="btn btn-info btn-xs lookBtn" href="javascript:;" data-id="${entity.id}">
                            <span class="glyphicon glyphicon-th"></span>查看
                        </a>
                    </td>
                </tr>
            </#list>
            </table>
        <#include "../common/page.ftl">
        </div>
    </div>
</div>

<div class="modal fade" id="contentModal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">文章内容</h4>
            </div>
            <div class="modal-body">
                xxxxxxxxx
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

</body>
</html>